package com.diyunapp.xilinapp.utils;

import retrofit.GsonConverterFactory;
import retrofit.Retrofit;
import retrofit.RxJavaCallAdapterFactory;

/**
 * Created by zxc on 2016-01-18.
 */
public class RetrofitUtils<T> {

    public static final String BASE_URL = "http://121.42.195.167:82/";

    private static Retrofit retrofit;

    public static Retrofit getInstance(){

        if(retrofit == null){
            synchronized (RetrofitUtils.class){
                if(retrofit == null){
                    retrofit = new Retrofit.Builder()
                            .baseUrl(BASE_URL)
                            .addCallAdapterFactory(RxJavaCallAdapterFactory.create()) // 使用RxJava作为回调适配器
                            .addConverterFactory(GsonConverterFactory.create()) // 使用Gson作为数据转换器
                            .build();
                }
            }
        }
        return retrofit;
    }
}
